window.onload=function(){
    $.ajax({
        type:"post",
        url:"/js/xiangqing",
        data:null,
        dataType:"json",
        success:function(data){
            let dataObj=JSON.parse(data);

            let bigDivObj=document.getElementsByClassName("big-img")[0];
            let bigimgobj=bigDivObj.getElementsByTagName("img")[0];

            let smallDivObj=document.getElementsByClassName("small-img")[0];
            let smallimgobj=smallDivObj.getElementsByTagName("img")[0];

            bigimgobj.src=`../img/${dataObj.teaImg}`
            smallimgobj.src=`../img/${dataObj.teaImg}`

            let h1obj=document.getElementsByClassName("h1")[0];
            h1obj.innerHTML=dataObj.teaName;

            let spanObj=document.getElementById("teaprice");
            spanObj.innerText=`￥${dataObj.teaPrice}`;

            let pobj=document.getElementById("teas");
            pobj.innerHTML=dataObj.teaDescrible;

            let id=document.getElementById("teaid");
            id.innerText=`编号:${dataObj.id}`;

            let teaclass=document.getElementById("teaclass");
            teaclass.innerText=`分类:${dataObj.teaClass}`

             let bannerclass=document.getElementById("bannerclass");
             bannerclass.innerText=`${dataObj.teaClass}`

             let bannername=document.getElementById("bannername");
             bannername.innerText=dataObj.teaName;

        }
    })
}
function addshop(){
    $.ajax({
        type:"post",
        url:"/js/addshop",
        data:null,
        dataType:"json",
        success:function(data){
            if(data){
                alert("添加到购物车成功");
            }else{
                alert("添加到购物车失败");
            }
        }
    })
}